package com.bwie.es.remote.focaty;

import com.bwie.common.domain.request.ShopRequest;
import com.bwie.common.domain.response.ShopResponse;
import com.bwie.common.exctption.BizException;
import com.bwie.common.result.Result;
import com.bwie.es.remote.ShopRemote;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 熔断
 *
 * @author <a href="mailto:2891704036@qq.com">zhiyuheng</a>
 * @version 1.0
 * @description: 熔断
 * @date 2025/9/9 10:48
 */
@Component
public class ShopRemoteFallback implements FallbackFactory<ShopRemote> {
    @Override
    public ShopRemote create(Throwable cause) {
        return new ShopRemote() {
            @Override
            public Result<List<ShopResponse>> shopList(ShopRequest shopRequest) {
                throw new BizException("当前服务器繁忙，请稍后再试");
            }
        };
    }
}
